package com.doudou.collection.domain.service.impl;


import com.doudou.collection.dao.mapper.UserDetailMapper;
import com.doudou.collection.domain.service.UserDetailService;
import com.doudou.collection.orm.vo.UserDetailFansAndFollowVO;
import com.doudou.collection.orm.vo.UserDetailStandardVO;
import com.doudou.collection.orm.vo.UserSimpleVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * className: UserDetailServiceImpl<br>
 * description: 个人信息模块业务逻辑类实现类<br>
 * author: 王林峰<br>
 * date: 2023/6/23 10:00<br>
 * version: 1.0<br>
 */
@Slf4j
@Service
public class UserDetailServiceImpl implements UserDetailService {


    @Autowired
    UserDetailMapper userDetailMapper;


    /**
     * 查询当前用户的粉丝列表
     * @param id
     * @return
     */
    @Override
    public List<UserSimpleVO> selectFansListById(Long id) {
        log.debug("开始处理【查询用户粉丝列表业务】, 参数：{}", id);
        List<UserSimpleVO> list = userDetailMapper.selectFansListById(id);
        log.info("查询成功");
        return list;
    }

    /**
     * 查询当前用户关注列表
     * @param id
     * @return
     */
    @Override
    public List<UserSimpleVO> selectFollowListById(Long id) {
        log.debug("开始处理【查询用户关注列表业务】, 参数：{}", id);
        List<UserSimpleVO> list = userDetailMapper.selectFollowListById(id);
        log.info("查询成功 {}", list);
        return list;
    }

    /**
     * 查询当前用户粉丝数
     * @param id
     * @return
     */
    @Override
    public UserDetailFansAndFollowVO selectFansCountById(Long id) {
        log.debug("开始处理【查询用户数量业务】, 参数：{}", id);
        UserDetailFansAndFollowVO fansAndFollowVO = userDetailMapper.selectFansCountById(id);
        log.info("查询成功");
        return fansAndFollowVO;
    }

    /**
     * 查询当前用户关注数
     * @param id
     * @return
     */
    @Override
    public UserDetailFansAndFollowVO selectFollowsCountById(Long id) {
        log.debug("开始处理【查询用户关注数量业务】, 参数：{}", id);
        UserDetailFansAndFollowVO fansAndFollowVO = userDetailMapper.selectFollowsCountById(id);
        log.info("查询成功");
        return fansAndFollowVO;
    }

    /**
     * 查询当前登录用户详情
     * @param id  当前登录用户id
     * @return 用户详情vo
     */
    @Override
    public UserDetailStandardVO getStandardById(Long id) {
        log.debug("开始处理【查询用户详细信息业务】, 参数：{}", id);
        UserDetailStandardVO standard = userDetailMapper.getStandardById(id);
        log.debug("---------------------------:{}",standard);
        return standard;
    }
}
